CREATE
OR REPLACE PROCEDURE org_bb_insert_bhsq(p_phid IN NUMBER) 
AS 
BEGIN
    INSERT INTO crm3_tend_pay (
        phid,
        user_djly,
        phid_org,
        user_jbr,
        bill_no,
        phid_pc,
        user_xmbmc,
        user_bdmc,
        user_tbsj,
        phid_user,
        ng_insert_dt,
        bill_dt,
        --
        bill_name,
        phid_apply,
        phid_enterprise,
        payway,
        account,
        amt,
        money_capital,
        bank,
        state,
        isback,
        days,
        ischange,
        remarks,
        asr_flag,
        wf_flag,
        arc_flag,
        phid_app,
        app_status,
        level_code,
        print_count,
        bill_type,
        user_type,
        py,
        tr_flag,
        tr_type,
        tr_num,
        aux_items1,
        aux_items2,
        aux_items3,
        aux_name1,
        aux_name2,
        aux_name3,
        phid_tr_ocode,
        phid_schemeid,
        imp_info,
        phid_sourcemid,
        item_resource,
        ng_record_ver,
        creator,
        editor,
        cur_orgid,
        ng_phid_cu,
        ng_phid_bp,
        ng_phid_org,
        ng_phid_ui_scheme,
        ng_phid_original,
        ng_orgid_original,
        ng_sv_search_key,
        ng_sd_search_key,
        ng_share_sign,
        isimport,
        paidamt,
        ng_write_source
    )
    SELECT 
        seq_auto_phid_org_bb_bhsq.nextval,
        p_phid,
        phid_org,
        user_tbr,
        bill_no,
        phid_pc,
        user_xmmc,
        user_bdmc,
        tend_dt,
        user_tbr,
        TRUNC(SYSDATE),
        TRUNC(SYSDATE),
        --
        '',
        '1',
        '',
        '',
        '',
        0.000000,
        '',
        '',
        '1',
        '0',
        0,
        '0',
        '',
        0,
        0,
        0,
        '',
        0,
        0,
        0,
        '',
        '',
        '',
        0,
        '',
        '',
        '',
        '',
        '',
        '',
        '',
        '',
        0,
        6870000000000036,
        '',
        0,
        '',
        1,
        6870000000000009,
        6870000000000009,
        1,
        1,
        0,
        1,
        0,
        0,
        0,
        '10',
        '1',
        5,
        0,
        0,
        ''
    FROM crm3_tend_chk_m
    WHERE phid = p_phid;
    commit;
    EXCEPTION 
    WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE('插入失败，错误信息：' || SQLERRM);
    RAISE;
    ROLLBACK;
END org_bb_insert_bhsq;